<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<script>
    const array = ['hello', 'world', 'test', 'good'];

    console.log([...array].map(i => i.toUpperCase()));

    //数组的解构赋值,[自定义名](如果想要忽略某个值,可以使用','忽略),会按照索引的顺序,依次从array中取值赋给声明的变量
    let [, w, t, g] = array
    //console.log(h)
    console.log(w)
    console.log(t)
    console.log(g)

    const cat = {
        name: 'kiki',
        age: 2,
        color: 'white',
        eat: function () {
            console.log('eat fish...')
        }
    }
    // 对象的解构赋值,语法是{字段名}
    let {age, color} = cat
 
    //提取函数
    let {eat} = cat;
    eat();
</script>
</body>
</html>
